/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.web.servlet;

import com.web.daoimpl.StudentDaoImpl;
import com.web.service.Testdaoimpl;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 *
 * @author liqianru
 */
@WebServlet("/deleteStu")
public class Admin_deleteStu extends HttpServlet {

    StudentDaoImpl service = new StudentDaoImpl();
    Testdaoimpl testService=new Testdaoimpl();
    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        //
        if (req.getParameter("action").equals("delete_stu")) {
            String sid = req.getParameter("sid");
            //
            int row = service.deleteStudent(sid);
            System.out.println("删除了" + row + "行");
            //
            resp.getWriter().print(row);
        }
        if(req.getParameter("action").equals("delete_test")){
            String qid=req.getParameter("qid");
            int t_row=testService.deleteTest(qid);
            resp.getWriter().print(t_row);
        }
    }

}
